﻿namespace WriterStars.Model
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;

    public class Book : IEntity
    {
        private ICollection<Tag> tags;
        private ICollection<Like> likes;

        public Book()
        {
            this.tags = new HashSet<Tag>();
            this.likes = new HashSet<Like>();
        }

        public int Id { get; set; }

        [Required]
        public string Title { get; set; }

        public string Description { get; set; }

        public int AuthorId { get; set; }

        public virtual Author Author { get; set; }

        public virtual DateTime Date { get; set; }

        public virtual ICollection<Tag> Tags
        {
            get { return this.tags; }
            set { this.tags = value; }
        }

        public virtual ICollection<Like> Likes 
        { 
            get { return this.likes; } 
            set { this.likes = value; } 
        }

        public int? CategoryId { get; set; }

        public virtual Category Category { get; set; }
    }
}